package csao.ui;

import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.Date;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;

public class DayPanel extends JPanel {
	private Date date = null;

	private GridBagConstraints gbc = null;

	private JLabel dateLabel = null;
	private JTextArea entries[] = null;

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;

		dateLabel.setText(String.valueOf(date));
	}

	public DayPanel() {
		super();
		gbc = new GridBagConstraints();

		dateLabel = new JLabel(String.valueOf(date));
		entries = new JTextArea[1];

		for (int i = 0; i < entries.length; i++) {
			entries[i] = new JTextArea(1, 15);
		}

		init();
		addComponents();
	}

	private void init() {
		setBackground(Color.black);
		setLayout(new GridBagLayout());
	}

	private void addComponents() {
		gbc.gridx = gbc.gridy = 0;
		gbc.gridwidth = gbc.gridheight = 1;
		gbc.anchor = GridBagConstraints.CENTER;
		add(dateLabel);

		for (int i = 0; i < entries.length; i++) {
			entries[i] = new JTextArea(1, 15);
			gbc.gridy++;
			add(entries[i], gbc);
		}
	}
}